<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'roomlist.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">
			var roomId = null;
			
			
	function detailRoom(cid) {		
			roomId = cid;		
	}
	

	function goDetailRoom() {

		if (roomId == null || roomId == "") {

			alert("请先选择要查看的人员后再点'详细信息'按钮！");
		} else {
			location.href = "/electronsys/room/showRoom?ccId=" + roomId;
		}
	}	

	function deleteRoom() {
		var roomid = document.getElementsByName("check");
		var e = true;
		for ( var i = 0; i < roomid.length; i++) {
			if (roomid[i].checked == true) {
				if (confirm("确定要删除吗？")) {
					location.href = "/electronsys/room/deleteRoom?ccId="
							+ roomid[i].value;
							e = false;
				} else {
					e = false;
				}
			}
		}
		if (e) {
			alert("请先选择要删除的人员后再点'删除'按钮！");
		}
	}
</script>
	</head>

	<body>
		<FORM name=myForm action=dept.do?oprate=delete method=post>
		<div id="content_right">
			<TABLE class=table cellSpacing=1>
				<TBODY>
					<TR class=table_header>						
						<TD vAlign=center align=left>
							机房ID
						</TD>
						<TD vAlign=center align=left>
							机房名称
						</TD>
						<TD vAlign=center align=left>
							所属部门编号
						</TD>
						<TD vAlign=center align=left>
							负责人编号
						</TD>
						<TD vAlign=center align=left>
							地址
						</TD>
						<TD vAlign=center align=left>
						          详细选中
						</TD>			
						<TD vAlign=center align=left>
						          
						</TD>			
						<TD vAlign=center align=left>
						           删除选中
						</TD>
					</TR>
					<s:iterator value="listroom" var="lir" status="s">
									<tr class="row${st.index%2+1}">
									
										<td valign="middle" align="left">
											<s:property value="#lir.ccId" />
										</td>
										<td valign="middle" align="left">
											<s:property value="#lir.ccName" />
										</td>
										<td valign="middle" align="left">
										<s:property value="#lir.employee.empId" />											
										</td>
										<td valign="middle" align="left">
											<s:property value="#lir.department.deptId" />
										</td>
										
										<td valign="middle" align="left">
											<s:property value="#lir.ccAddr" />
										</td>
										
										<td valign="middle" align="left">
											<input type="radio"  name="choose" onClick="detailRoom('<s:property value="#lir.ccId"/>');"  />
										</td>
										<td valign="middle" align="left">
											<a href="/electronsys/room/toUpdateRoom.action?ccId=${lir.ccId}">修改机房</a>
										</td>
										<td valign="middle" align="left">										
											<input type="checkbox" name="check" value="${lir.ccId}">
										</td>
									</tr>
								</s:iterator>
					
					</TR>
					
				</TBODY>
			</TABLE>
			<BR>
			<BR>
			<BR>
			<p class="paging">
							<s:if test="%{page == 1}">
							&lt;&lt; 首页 &lt; 上一页
						</s:if>
							<s:else>
								<a href="room/roomList.action?page=1"> &lt;&lt;首页</a>
								<a href="room/roomList.action?page=${page-1}">&lt; 上一页 </a>
							</s:else>

							<strong>第${page}页/共${totalPages}页</strong>

							<s:if test="%{page == totalPages}">
							下一页 &gt;
							末页 &gt;&gt;
						</s:if>
							<s:else>
								<a href="room/roomList.action?page=${page+1}"> 下一页 &gt;</a>
								<a href="room/roomList.action?page=${totalPages}">末页 &gt;&gt;</a>
							</s:else>
						</p>
			<BR>
			<P align=right>
				<input type="button" class="button" value="机房详细信息"
								onClick="goDetailRoom();" />			   
			    <input type="button" Class="button" value=" 删除机房 "
								onClick="deleteRoom();" />
			</P>
			</div>
		</FORM>
	</body>
</html>
